STANDALONE_PATH=/home/wzl/standalone

WORK_DIR=$STANDALONE_PATH/out/x64.debug
ES2ABC=$WORK_DIR/arkcompiler/ets_frontend/es2abc
ARK_JS_VM=$WORK_DIR/arkcompiler/ets_runtime/ark_js_vm

TEST_CASE=$1
TEST_CASE_BASENAME=${TEST_CASE%.*}

# set env
echo export LD_LIBRARY_PATH=$WORK_DIR/thirdparty/bounds_checking_function:$WORK_DIR/arkcompiler/ets_runtime
export LD_LIBRARY_PATH=$WORK_DIR/thirdparty/bounds_checking_function:$WORK_DIR/arkcompiler/ets_runtime

# generate bytecode
echo $ES2ABC --merge-abc --output $TEST_CASE_BASENAME.abc $TEST_CASE
$ES2ABC --merge-abc --output $TEST_CASE_BASENAME.abc $TEST_CASE

# execute
echo $WORK_DIR/arkcompiler/ets_runtime/ark_js_vm --asm-interpreter=true --entry-point=$TEST_CASE_BASENAME --compiler-enable-baselinejit=true --compiler-force-baselinejit-compile-main=true --log-level=debug --log-components=baselinejit $TEST_CASE_BASENAME.abc
$WORK_DIR/arkcompiler/ets_runtime/ark_js_vm --asm-interpreter=true --entry-point=$TEST_CASE_BASENAME --compiler-enable-baselinejit=true --compiler-force-baselinejit-compile-main=true --log-level=debug --log-components=baselinejit $TEST_CASE_BASENAME.abc
